package com.paohe.lianxin_pda.production_line.picking;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.TimePickerView;
import com.paohe.lianxin_pda.R;
import com.paohe.lianxin_pda.utils.toast.CustomToast;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Picking extends AppCompatActivity {
    private ImageView back;//返回
    private TextView title,pickTime;//标题名称
    private EditText pickOrder,pickPeople;
    private TimePickerView pvTime;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_picking);

        back = findViewById(R.id.back);
        title = findViewById(R.id.title_name);
        pickOrder = findViewById(R.id.picking_edit_order);
        pickPeople = findViewById(R.id.picking_edit_people);
        pickTime = findViewById(R.id.picking_time);

        //唤起时间选择控件
        pickTime.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pvTime = new TimePickerBuilder(Picking.this, new OnTimeSelectListener() {
                    @Override
                    public void onTimeSelect(Date date, View v) {
                        SimpleDateFormat formatter = new SimpleDateFormat("YYYY-MM-dd");
                        String dateStr = formatter.format(date);
                        pickTime.setText(dateStr);
                    }
                })      .setType(new boolean[]{true, true, true, true, true, true})
                        .setLabel("年","月","日","时","分","秒")//默认设置为年月日时分秒
                        .build();
                pvTime.show();
            }
        });

        //给标签赋值
        title.setText(R.string.picking_ll);

        //返回按钮
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
